package global

import (
	"token-centre/model"

	"gorm.io/driver/sqlite"
	"gorm.io/gorm"
)

var Db *gorm.DB

func InitDb() {
	var err error
	Db, err = gorm.Open(sqlite.Open("token-centre.sqlite3"), &gorm.Config{})

	if err != nil {
		panic("failed to connect database")
	}

	Db.AutoMigrate(&model.App{}, &model.App{})
}
